class ColorsChanges < ActiveRecord::Migration
  def self.up
    # Drops Colors table
    drop_table :colors

    # Changes product_colors table
    remove_column :product_colors, :color_id
    add_column :product_colors, :color_code, :string, :length => 10
    add_column :product_colors, :color_name, :string, :length => 100
    add_column :product_colors, :sold_out, :boolean, :default => false
  end

  def self.down
    create_table :colors do |t|
      t.string :code, :length => 10
      t.string :name, :length => 25
      t.timestamps
    end

    add_column :product_colors, :color_id, :integer
    remove_column :product_colors, :color_code
    remove_column :product_colors, :color_name
    remove_column :product_colors, :sold_out
  end
end
